home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / misc / pclta-1.000 / pclta-1 / hostappl / ni_mgmt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-18  |  5.1 KB  |  186 lines

  1. /*
  2.  * ni_mgmt.h,v 1.0 1996/03/18 14:18:33 miksic Exp
  3.  */
  4.  
  5. /* NI_MGMT.H -- Host application network management codes and messages.
  6.  * Copyright (c) 1992, 1993 by Echelon Corporation.
  7.  * All Rights Reserved.
  8.  *
  9.  * Network management codes and messages for an application node.
  10.  * This file contains a subset of the LonTalk network management structures.
  11.  * The types have been changed where necessary because of the difference
  12.  * in representations between Neuron and MS-DOS objects.
  13.  */
  14.  
  15. #define ID_STR_LEN 8            /* program ID length */
  16.  
  17. #define NULL_IDX  15            /* unused address table index */
  18.  
  19. typedef struct {
  20.     bits    selector_hi : 6;
  21.     bits    direction   : 1;
  22.     bits    priority    : 1;
  23.     bits    selector_lo : 8;
  24.     bits    addr_index  : 4;
  25.     bits    auth        : 1;
  26.     bits    service     : 2;
  27.     bits    turnaround  : 1;
  28. } nv_struct;
  29.  
  30. // Note - Microsoft C will make nv_struct 4 bytes long because it does
  31. // not allow odd-length bit-fields.  It is really 3 bytes long.
  32. // Be careful when using sizeof() any structure that includes an nv_struct.
  33.  
  34. #define NM_update_nv_cnfg        0x6B
  35. #define NM_update_nv_cnfg_fail   0x0B
  36. #define NM_update_nv_cnfg_succ   0x2B
  37.  
  38. typedef struct {
  39.     byte        code;
  40.     nv_struct   nv_cnfg;
  41. } NM_query_nv_cnfg_response;
  42.  
  43. #define NM_query_nv_cnfg        0x68
  44. #define NM_query_nv_cnfg_fail   0x08
  45. #define NM_query_nv_cnfg_succ   0x28
  46.  
  47. typedef enum {
  48.     APPL_OFFLINE   = 0,             /* Soft offline state                   */
  49.     APPL_ONLINE,
  50.     APPL_RESET,
  51.     CHANGE_STATE
  52. } nm_node_mode;
  53.  
  54. typedef enum {
  55.     APPL_UNCNFG    = 2,
  56.     NO_APPL_UNCNFG = 3,
  57.     CNFG_ONLINE    = 4,
  58.     CNFG_OFFLINE   = 6,             /* Hard offline state                   */
  59.     SOFT_OFFLINE   = 0xC
  60. } nm_node_state;
  61.  
  62. typedef struct {
  63.     byte        code;
  64.     byte        mode;               /* Interpret with 'nm_node_mode'        */
  65.     byte        node_state;         /* Optional field if mode==CHANGE_STATE */
  66.                                     /* Interpret with 'nm_node_state'       */
  67. } NM_set_node_mode_request;
  68.  
  69. #define NM_set_node_mode 0x6C
  70.  
  71. typedef enum {
  72.     ABSOLUTE           = 0,
  73.     READ_ONLY_RELATIVE = 1,
  74.     CONFIG_RELATIVE    = 2,
  75. } nm_mem_mode;
  76.  
  77. typedef enum {
  78.     NO_ACTION      = 0,
  79.     BOTH_CS_RECALC = 1,
  80.     CNFG_CS_RECALC = 4,
  81.     ONLY_RESET     = 8,
  82.     BOTH_CS_RECALC_RESET = 9,
  83.     CNFG_CS_RECALC_RESET = 12,
  84. } nm_mem_form;
  85.  
  86. typedef struct {
  87.     byte    code;
  88.     byte    mode;
  89.     byte    offset_hi;
  90.     byte    offset_lo;
  91.     byte    count;
  92.     byte    form;                    // followed by the data
  93. } NM_write_memory_request;
  94.  
  95. #define NM_write_memory 0x6E
  96.  
  97. typedef struct {
  98.     byte    length_hi;
  99.     byte    length_lo;
  100.     byte    num_netvars;
  101.     byte    version;         // version 0 format
  102.     byte    mtag_count;
  103. } snvt_struct_v0;
  104.  
  105. typedef struct {
  106.     byte    length_hi;
  107.     byte    length_lo;
  108.     byte    num_netvars_lo;
  109.     byte    version;          // version 1 format
  110.     byte    num_netvars_hi;
  111.     byte    mtag_count;
  112. } snvt_struct_v1;
  113.  
  114. // Partial list of SNVT type index values
  115.  
  116. typedef enum {
  117.     SNVT_str_asc  = 36,
  118.     SNVT_lev_cont = 21,
  119.     SNVT_lev_disc = 22,
  120.     SNVT_count_f  = 51,
  121. } SNVT_t;
  122.  
  123. typedef struct {
  124.     bits    nv_config_class     :1;
  125.     bits    nv_auth_config      :1;
  126.     bits    nv_priority_config  :1;
  127.     bits    nv_service_type_config :1;
  128.     bits    nv_offline          :1;
  129.     bits    nv_polled           :1;
  130.     bits    nv_sync             :1;
  131.     bits    ext_rec             :1;
  132.     bits    snvt_type_index     :8;        // use enum SNVT_t
  133. } snvt_desc_struct;
  134.  
  135. typedef struct {
  136. #ifdef   _MSC_VER
  137.     byte        mask;          // Microsoft C does not allow odd-length
  138. #else                          // bit fields
  139.     bits    unused :3;
  140.     bits    nc     :1;     // array count
  141.     bits    sd     :1;     // self-documentation
  142.     bits    nm     :1;     // network variable name
  143.     bits    re     :1;     // rate estimate
  144.     bits    mre    :1;     // max rate estimate
  145. #endif
  146. } snvt_ext_rec_mask;
  147.  
  148. // Network management message codes
  149.  
  150. #define NM_query_SNVT           0x72
  151. #define NM_query_SNVT_fail      0x12
  152. #define NM_query_SNVT_succ      0x32
  153.  
  154. typedef struct {
  155.     byte    code;
  156.     byte    offset_hi;     // big-endian 16-bits
  157.     byte    offset_lo;
  158.     byte    count;
  159. } NM_query_SNVT_request;
  160.  
  161. #define NM_wink 0x70
  162.  
  163. #define NM_NV_fetch         0x73
  164. #define NM_NV_fetch_fail    0x13
  165. #define NM_NV_fetch_succ    0x33
  166.  
  167. // Explicit application message codes
  168.  
  169. #define NA_appl_msg         0x00
  170. #define NA_appl_offline     0x3F
  171. #define NA_foreign_msg      0x40
  172. #define NA_foreign_offline  0x4F
  173.  
  174. // Structure used by host application to store network variables
  175.  
  176. typedef enum { NV_IN = 0, NV_OUT = 1 } nv_direction;
  177.  
  178. typedef struct {                         // structure to define NVs
  179.     int             size;                // number of bytes
  180.     nv_direction    direction;           // input or output
  181.     const           char * name;         // name of variable
  182.     void            ( * print_func )( byte * ); // routine to print value
  183.     void            ( * read_func )( byte * );  // routine to read value
  184.     byte            data[ MAX_NETVAR_DATA ];    // actual storage for value
  185. } network_variable;
  186.